package com.netty.rpc.monitor.trace;

import com.netty.rpc.common.delegate.NettyRpcDelegateImpl;
import com.netty.rpc.common.entity.NettyRpcMessage;
import org.springframework.beans.BeanUtils;
import org.springframework.util.StringUtils;


public abstract class AbstractMonitor extends NettyRpcDelegateImpl implements Monitor {

    @Override
    public MonitorMessage create(NettyRpcMessage message) {
        if (StringUtils.isEmpty(message.getTraceId())) {
            return null;
        }
        MonitorMessage monitorMessage = new MonitorMessage();
        BeanUtils.copyProperties(message, monitorMessage);
        monitorMessage.setInterfaceClassName(message.getInterfaze());
        return monitorMessage;
    }

}
